<?php

namespace app\admin\controller;

use app\admin\service\RefundService;
use support\Request;

class RefundController extends Base
{

    /**
     * 退款列表
     */
    public function index()
    {
        if (request()->isAjax()) {
            $refundService = new RefundService();
            $res = $refundService->getList(request()->all());
            return sparkSuccess($res);
        }
        return view('refund/index');
    }

    /**
     * 订单详情
     */
    public function detail()
    {
        $orderId = request()->input('id');
        $refundId = request()->input('refund');

        $refundService = new RefundService();
        $res = $refundService->getDetail($orderId, $refundId);
        return sparkSuccess($res);
    }

    /**
     * 退货审核
     */
    public function checkRefundGoods()
    {
        $param =  request()->post();
        $refundService = new RefundService();
        $refundService->checkRefundGoods($param);
        return sparkSuccess(dataReturn(0, '操作成功'));
    }

    /**
     * 退款审核
     */
    public function checkRefundMoney()
    {
        $param =  request()->post();
        $refundService = new RefundService();
        $res = $refundService->checkRefundMoney($param);
        return sparkSuccess($res);
    }
}